<?php
defined('BY_JYA') or exit('error');
$merchid=$this->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){

	$id=intval($_RQ['id']);
	if(!$id){
		exi('请先选择订单','error','list');
	}
		$status=array('1'=>'待发货','2'=>'待收货','3'=>'已完成','4'=>'已关闭');
		$paytype=array('1'=>'微信支付','2'=>'余额支付');
		$ispay=array('0'=>'未支付','1'=>'已支付');
		$return['item']=pdo_get('jy_supplier_order',array('id'=>$id));
		$return['item']['createtime']=date('Y-m-d H:i:s',$return['item']['createtime']);
		$return['item']['nickname']=pdo_getcolumn('core_members',array('id'=>$return['item']['mid']),'nickname');
		$return['item']['phone']=pdo_getcolumn('core_members',array('id'=>$return['item']['mid']),'mobile');			
		$address=pdo_get('core_address',array('id'=>$return['item']['addressid'],'uniacid'=>$_SESSION['uniacid']));
		$return['item']['address']=$address['province'].$address['city'].$address['address'];
		$return['item']['mobile']=$address['mobile'];
		$return['item']['realname']=$address['realname'];
		$q=$return['item']['status'];
		$return['item']['status']=$status[$q];
		$w=$return['item']['paytype'];
		$return['item']['paytype']=$paytype[$w];
		$e=$return['item']['ispay'];
		$return['item']['ispay']=$ispay[$e];
		if(!$return['item']['nickname']){
			$return['item']['nickname']='匿名用户';
		}
		$return['item']['payime']=date('Y-m-d H:i:s',$return['item']['payime']);
		$return['item']['sendtime']=date('Y-m-d H:i:s',$return['item']['sendtime']);
		$return['item']['finishtime']=date('Y-m-d H:i:s',$return['item']['finishtime']);	
	///print_r($return['item']);exit();
	$htmls=array(
		'type'=>'edit',
		'post'=>'post',
		'desc'=>'订单详情',		
		'edit'=>array(
			array('name'=>'ordersn','title'=>'订单号','type'=>'string','read'=>true),
			array('name'=>'nickname','title'=>'买家昵称','type'=>'string','read'=>true),
			//array('name'=>'phone','title'=>'买家电话','type'=>'string','read'=>true),
			array('name'=>'price','title'=>'金额','type'=>'string','read'=>true),
			array('name'=>'goodsprice','title'=>'商品小计','type'=>'string','read'=>true),
			array('name'=>'discountprice','title'=>'运费','type'=>'string','read'=>true),
			array('name'=>'mid','title'=>'会员id','type'=>'string','read'=>true),
			array('name'=>'address','title'=>'收货地址','type'=>'string','read'=>true),
			array('name'=>'realname','title'=>'收货人','type'=>'string','read'=>true),
			array('name'=>'mobile','title'=>'联系电话','type'=>'string','read'=>true),
			array('name'=>'remark','title'=>'备注','type'=>'string','read'=>true),
			array('name'=>'status','title'=>'订单状态','type'=>'string','read'=>true),	
			array('name'=>'ispay','title'=>'是否支付','type'=>'string','read'=>true),
			array('name'=>'paytype','title'=>'支付方式','type'=>'string','read'=>true,'show'=>array('ispay'=>'已支付')),			
			array('name'=>'createtime','title'=>'下单时间','type'=>'string','read'=>true),
			array('name'=>'paytime','title'=>'支付时间','type'=>'string','read'=>true,'show'=>array('ispay'=>'已支付')),
			array('name'=>'sendtime','title'=>'发货时间','type'=>'string','read'=>true,'show'=>array('ispay'=>'已支付')),
			array('name'=>'express','title'=>'快递公司','type'=>'string','read'=>true,'show'=>array('ispay'=>'已支付')),
			array('name'=>'expresssn','title'=>'快递单号','type'=>'string','read'=>true,'show'=>array('ispay'=>'已支付')),
		)
		);
	
	if($_SESSION['os']=='mobile'){
		$return['htmls']=$this->template_url('manage/order_detail');
	}else{
		$return['htmls']=$htmls;
	}
	$return['status']=array('0'=>'下单','1'=>'接单','2'=>'申请取消','3'=>'已取消','4'=>'已退款','5'=>'已完成');
	
	exi($return);
}